package com.cq.digitalemployee.user.dao;

import com.cq.digitalemployee.user.entity.po.SysPermission;

import java.util.List;
import java.util.Set;

/**
 * The interface Sys permission dao.
 */
public interface SysPermissionDao {
    int deleteByPrimaryKey(String id);

    int insert(SysPermission record);

    int insertSelective(SysPermission record);

    SysPermission selectByPrimaryKey(String id);

    int updateByPrimaryKeySelective(SysPermission record);

    int updateByPrimaryKey(SysPermission record);


    /**
     * Select all user permisson list.
     * <p>
     * 获取用户所有权限，包括角色权限和用户权限
     *
     * @param userId the user id
     * @return the list
     */
    Set<SysPermission> selectAllUserPermisson(String userId);

    Set<SysPermission> selectByUser(String userId);

    Set<SysPermission> selectByRole(String roleId);

    List<SysPermission> selectAll();

    int grantByUser(String permissionId, String userId);

    int grantByRole(String permissionId, String roleId);
}